package com.arpa.ntocc.common.mapper;

import com.arpa.ntocc.common.domain.dto.RoleDTO;
import com.arpa.ntocc.common.domain.entity.Role;
import com.arpa.ntocc.common.domain.vo.RoleVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 用户角色 Mapper 接口
 * </p>
 *
 * @author LEO
 * @since 2019-12-05
 */
public interface RoleMapper extends BaseMapper<Role> {

    /**
     * 查询列表
     * @param roleDTO
     * @return
     */
    List<RoleVO> queryList(RoleDTO roleDTO);

    /**
     * 查询合计,包含总数
     * @param roleDTO
     * @return
     */
    RoleVO queryListSum(RoleDTO roleDTO);

    /**
     * 查询用户的权限列表
     * @param partyCode
     * @return
     */
    @Select("select * from sys_role r join sys_party_role pr on r.code=pr.role_code where r.is_deleted=0 and  pr.is_deleted=0 and pr.party_code= #{partyCode} ")
    List<Role> listByPartyCode(String partyCode);
}
